package com.qf.ssm.controller;

import com.github.pagehelper.PageInfo;
import com.qf.ssm.po.Emp;
import com.qf.ssm.po.Store;
import com.qf.ssm.qo.StoreQo;
import com.qf.ssm.result.ResponseResult;
import com.qf.ssm.service.EmpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Autowired
    EmpService empService;

    @PostMapping("/list/{page}/{size}")
    public ResponseResult<PageInfo<Emp>> list(@PathVariable int page, @PathVariable int size, @RequestBody StoreQo storeQo){
        ResponseResult<PageInfo<Emp>> result = null;
        return ResponseResult.success(empService.empList(page, size, storeQo));
    }

    @PostMapping("/empRegister")
    public ResponseResult<Integer> empRegister(@RequestBody Emp emp) {
        return ResponseResult.success(empService.empRegister(emp));
    }

    @PostMapping("/empDimission")
    public ResponseResult<Integer> empDimission(@RequestParam("empName") String empName){
        return ResponseResult.success(empService.empDimission(empName));
    }

    @PostMapping("/empModification")
    public ResponseResult<Integer> empModification(@RequestBody Emp emp){
        return ResponseResult.success(empService.empModification(emp));
    }
}
